package com.owc.controller.admin;

import com.owc.domain.BaseResult;
import com.owc.domain.vo.admin.IntoToken;
import com.owc.service.admin.WithdrawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @Author xiaom
 * @Date 2019/12/17 10:20
 * @Version 1.0.0
 * @Description <>
 **/
@RestController
@RequestMapping(value = "/admin/wallet")
public class WithdrawController {

    @Autowired
    private WithdrawService withdrawService;

    /**
     * 划入
     * @param intoToken
     * @return
     */
    @PostMapping(value = "/transferInto")
    public BaseResult<Boolean> transferInto(@RequestBody @Valid IntoToken intoToken){
        Assert.notNull(intoToken.getTransferAmount(),"请输入划入金额");
        return BaseResult.success(withdrawService.transferInto(intoToken));
    }

    /**
     * 划出
     */
    @PostMapping(value = "/transferOut")
    public BaseResult<Boolean> transferOut(@RequestBody @Valid IntoToken intoToken){
        return BaseResult.success(withdrawService.transferOut(intoToken));
    }

}
